package cn.xuqiudong.backend.module.personal.controller;

import cn.xuqiudong.backend.base.controller.BaseGenericBackendController;
import cn.xuqiudong.common.base.model.BaseResponse;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.xuqiudong.backend.module.personal.service.PersonalAccountService;
import cn.xuqiudong.backend.module.personal.model.PersonalAccount;

/**
 *功能: : 控制层
 * @author Vic.xu
 * @since  2025-04-24 16:10
 */
@RestController
@RequestMapping("/personal/account")
public class PersonalAccountController extends BaseGenericBackendController<PersonalAccountService, PersonalAccount> {

    /**
     * 修改密码
     */
    @Operation(summary = "修改个人账户密码")
    @PostMapping(value = "/updatePassword/{id}")
    public BaseResponse<Boolean> updatePassword(@PathVariable Integer id, String password) {
        PersonalAccount account = new PersonalAccount();
        account.setId(id);
        account.setPassword(password);
        return BaseResponse.success(service.update(account) > 0);
    }
}
